package com.hqd.ch03.v47.boot.context.properties.source;

interface CachingConfigurationPropertySource {

    /**
     * Find {@link ConfigurationPropertyCaching} for the given source.
     *
     * @param source the configuration property source
     * @return a {@link ConfigurationPropertyCaching} instance or {@code null} if the
     * source does not support caching.
     */
    static ConfigurationPropertyCaching find(ConfigurationPropertySource source) {
        if (source instanceof CachingConfigurationPropertySource) {
            return ((CachingConfigurationPropertySource) source).getCaching();
        }
        return null;
    }

    /**
     * Return {@link ConfigurationPropertyCaching} for this source.
     *
     * @return source caching
     */
    ConfigurationPropertyCaching getCaching();

}